package cn.kgc.kgde.bookstore.controller;

import cn.kgc.kgde.bookstore.dto.CateDTO;
import cn.kgc.kgde.bookstore.entity.CateAuthor;
import cn.kgc.kgde.bookstore.entity.CatePress;
import cn.kgc.kgde.bookstore.entity.ResultInfo;
import cn.kgc.kgde.bookstore.service.CateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author myt
 * @since 2022-06-13
 */
@RestController
@RequestMapping("/cate")
public class CateController {

    @Autowired
    private CateService cateService;

    /**
     * 商品展示页，页头方法
     * 查询全部和根据条件查询，
     * @return
     */
    @GetMapping("showCate")
    public ResultInfo showCate(){
            List<CateDTO> cateDTOList = this.cateService.cateList();

        return new ResultInfo(200,"全部搜索",cateDTOList);
    }
    @PostMapping("showCateFind")
    public ResultInfo showCateFind(CateDTO cateDTO){
        System.out.println("cateDTO = " + cateDTO);
            List<CateDTO> cateDTOList =this.cateService.cateFind(cateDTO);
            return new ResultInfo(200,"查询搜索",cateDTOList);

    }
}
